ff-cl-gen
OpenCL code generator for finite-field arithmetic over prime fields constructed with Rust ff library.
Notes:
- Limbs are 32/64-bit long, by your choice.
- The library assumes that the most significant bit of your prime-field is unset. This allows for cheap reductions.
Usage
Generating OpenCL codes for Bls12-381 Fr elements:
use Fr;
let src = ;
Generated interface (FIELD
is substituted with Fr
):
typedef struct FIELD;
bool ; // Greater than or equal
bool ; // Equal
FIELD ; // Modular subtraction
FIELD ; // Modular addition
FIELD ; // Modular multiplication
FIELD ; // Modular squaring
FIELD ; // Modular doubling
FIELD ; // Modular power
FIELD ; // Modular power with lookup table for bases
FIELD ; // To montgomery form
FIELD ; // To regular form
bool ; // Get `i`th bit (From most significant digit)
uint ; // Get `window` consecutive bits, (Starting from `skip`th bit from most significant digit)
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.